package com.journaldev.spring.service;

import java.util.List;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.journaldev.spring.dao.CityDAO;
import com.journaldev.spring.dao.MedicineDAO;
import com.journaldev.spring.model.Medicine;

@Service
public class MedicineServiceImpl implements MedicineService {

	private MedicineDAO medicineDAO;

	public void setMedicineDAO(MedicineDAO dao) {
		this.medicineDAO = dao;
	}
	
	@Override
	@Transactional
	public void addMedicine(Medicine p) {
		// TODO Auto-generated method stub
		medicineDAO.addMedicine(p);
	}

	@Override
	@Transactional
	public void updateMedicine(Medicine p) {
		// TODO Auto-generated method stub
		medicineDAO.updateMedicine(p);
	}

	@Override
	@Transactional
	public List<Medicine> listMedicine() {
		// TODO Auto-generated method stub
		return medicineDAO.listMedicine();
	}

	@Override
	@Transactional
	public Medicine getMedicineById(int id) {
		// TODO Auto-generated method stub
		return medicineDAO.getMedicineById(id);
	}

	@Override
	@Transactional
	public void removeMedicine(int id) {
		// TODO Auto-generated method stub
		medicineDAO.removeMedicine(id);
	}

}
